﻿using DimensionsHelper.LanguageService.Syntax;

namespace DimensionsHelper.LanguageService.Symbols;

/// <summary>
///     行标签符号，在脚本中使用 Label: 声明，必须单独占一行
/// </summary>
public class LabelSymbol : AbstractSymbol
{
    internal LabelSymbol(LabelDeclaration declaration) : base(SymbolKinds.Label)
    {
        Declaration = declaration;
    }


    internal LabelSymbol(SectionStatement section) : base(SymbolKinds.Label)
    {
        Declaration = section;
    }


    /// <summary>
    ///     声明此符号的节点
    /// </summary>
    public IDeclaration Declaration { get; }

    public override string Name => string.IsNullOrEmpty(Declaration.Name) ? base.Name : Declaration.Name;

    public override string FullName => Name;
}